import request from '../utils/request'

/**
 * 查询所有角色信息
 * @param roleName
 * @param current
 * @param size
 * @returns {AxiosPromise}
 */
export const findByName=(roleName,current,size)=>{
  return request({
    url: "/systems/role/findAll",
    method: "get",
    params: {
      roleName,
      current,
      size
    }
  })
}

/**
 * 获取需要修改的角色信息
 * @param roleName
 * @param current
 * @param size
 * @returns {AxiosPromise}
 */
export const compile=(id)=>{
  return request({
    url: "/systems/role/compile",
    method: "get",
    params: {
      id
    }
  })
}

/**
 * 修改角色信息
 * @param rols
 * @returns {AxiosPromise}
 */
export const updateRole=(rols)=>{
  return request({
    url: "/systems/role/updateRole",
    method: "post",
    data: rols
  })
}

/**
 * 新增角色信息
 * @param rols
 * @returns {AxiosPromise}
 */
export const addRole=(rols)=>{
  return request({
    url: "/systems/role/addRole",
    method: "post",
    data: rols
  })
}

/**
 * 修改角色状态
 * @param rols
 * @returns {AxiosPromise}
 */
export const editRoleState=(id)=>{
  return request({
    url: "/systems/role/editRoleState",
    method: "get",
    params:{
      id
    }
  })
}

/**
 * 导出角色信息
 * @param roleName
 * @returns {AxiosPromise}
 */
export function exportRoleInfo(roleName) {
  return request({
    url: '/systems/role/export',
    method: 'post',
    params: {
      roleName
    },
    responseType: "blob"
  })
}
